//
//  ViewController.m
//  UIButton
//
//  Created by 楼楚 on 16/3/22.
//  Copyright © 2016年 Chu Lou. All rights reserved.
//

#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    UIButton *button1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];
    
    [button1.layer setMasksToBounds:YES];
    [button1.layer setCornerRadius:4.f];
    
    button1.frame = CGRectMake(50, 50, 250, 50);
    
//    [button1 setFrame:CGRectMake(50, 50, 250, 50)];
    
    button1.backgroundColor = [UIColor redColor];
    [button1 setBackgroundColor:[UIColor redColor]];
    
    [button1 setImage:@"这里写图片名称" forState:UIControlStateNormal];
    
    [button1 setTitle:@"这里写按钮上的文字" forState:UIControlStateNormal];
    [button1 setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    button1.showsTouchWhenHighlighted = YES;
    
    [button1 addTarget:self action:@selector(buttonTouch) forControlEvents:UIControlEventTouchUpInside];
    
    
}
- (void)buttonTouch{
    NSLog(@"button is touched");
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end
